package com.ht.base.system.biz.client.impl;

import com.ht.base.system.biz.manager.SysPostManager;
import com.ht.base.system.client.SysPostClient;
import com.ht.base.system.common.pojo.bo.SysPostBO;
import com.ht.base.system.common.pojo.qto.SysPostQTO;
import org.base.common.appexception.AppException;
import org.base.common.appexception.ResultData;
import org.base.common.page.PageBO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author hdengxian
 * @Date 2023/8/15 17:21
 */
@DubboService
@Component
public class SysPostClientImpl implements SysPostClient {
    @Resource
    private SysPostManager sysPostManager;

    @Override
    public ResultData<Boolean> insertPost(SysPostBO post) throws AppException {
        return new ResultData<>(sysPostManager.insertPost(post));
    }

    @Override
    public ResultData<Boolean> updatePost(SysPostBO post) throws AppException {
        return new ResultData<>(sysPostManager.updatePost(post));
    }

    @Override
    public ResultData<Boolean> deletePost(Long[] sysPostIds) throws AppException {
        return new ResultData<>(sysPostManager.deletePost(sysPostIds));
    }

    @Override
    public ResultData<SysPostBO> getPostById(Long sysPostId) throws AppException {
        return new ResultData<>(sysPostManager.getPostById(sysPostId));
    }

    @Override
    public ResultData<List<SysPostBO>> getPostList() throws AppException {
        return new ResultData<>(sysPostManager.getPostList());
    }

    @Override
    public ResultData<PageBO<SysPostBO>> getPostForPage(SysPostQTO qto) throws AppException {
        return new ResultData<>(sysPostManager.getPostForPage(qto));
    }
}
